import request from '@/utils/request'

// 查询报关单跟踪列表（使用现有的list接口）
export function listTracking(query) {
  return request({
    url: '/fiscale/declaration/list',
    method: 'get',
    params: query
  })
}

// 手动刷新单个报关单状态
export function refreshStatus(declarationId) {
  return request({
    url: '/fiscale/declaration/refreshStatus/' + declarationId,
    method: 'post'
  })
}

// 批量刷新报关单状态
export function batchRefreshStatus(data) {
  return request({
    url: '/fiscale/declaration/batchUpdateStatus',
    method: 'put',
    data: data
  })
}

// 查看海关回执
export function getCustomsReceipt(declarationId) {
  return request({
    url: '/fiscale/declaration/receipt/' + declarationId,
    method: 'get'
  })
}

// 下载结关单
export function downloadClearanceDocument(declarationId) {
  return request({
    url: '/fiscale/declaration/downloadClearance/' + declarationId,
    method: 'get'
  })
}

// 获取报关单状态历史（暂时不实现）
export function getStatusHistory(declarationId) {
  return request({
    url: '/fiscale/declaration/statusHistory/' + declarationId,
    method: 'get'
  })
}

// 从海关API查询状态（暂时不实现）
export function queryStatusFromCustoms(preEntryNo) {
  return request({
    url: '/fiscale/declaration/queryFromCustoms/' + preEntryNo,
    method: 'get'
  })
}